<?php $this->_extends('_layouts/main_layout'); ?>
<?php $this->_block('contents'); ?>
<script type="text/javascript">

function deletePic(){
		return confirm('确定删除图片吗？');
	
}

$(function(){
	$('#form_banner').submit(function(){
		if($.trim($('#title').val()) == ''){
			alert('请输入名称！');
			$('#title').focus();
			return false;	
		}
		if($.trim($('#the_url').val()) == ''){
			alert('请输入地址！');
			$('#the_url').focus();
			return false;	
		}
		if(confirm('您确定要提交吗？')){
			return true;	
		}else{
			return false;
		}
	});	
});
</script>
<?php echo $alert;?>
<style>
/*打印表格*/
.print_table {
	border-collapse:collapse;/*border:1px solid #000000;*/
}
.print_table th {
	border:1px solid #CCCCCC;
}
.print_table td {
	border:1px solid #CCCCCC;
}
</style>
<form class="fsimple" id="form_banner" name="form_banner" action="" method="post" enctype="multipart/form-data" >
  <fieldset class="query_form" style="margin-top:10px;">
    <legend>修改友情链接 </legend>
    <table width="1000">
      <tr height="30">
        <td width="146" >名称：</td>
        <td width="842" ><input name="title" type="text"  id="title" value="<?php echo $myData['title'];?>" size="50" /><font class="req">*</font></td>
      </tr>
      <tr height="30">
        <td width="146" >类型：</td>
        <td width="842" >
        	<select name="type_id">
            <?php
            	foreach($banner_type as $k => $v){
					$sel = '';
					if($myData['type_id'] == $k){
						$sel = 'selected';	
					}
					echo '<option value="'.$k.'" '.$sel.'>'.$v.'</option>';	
				}
			?>
            </select><font class="req">*</font></td>
      </tr>
      <tr height="30">
        <td width="146" >地址：</td>
        <td width="842" ><input name="the_url" type="text"  id="the_url" value="<?php echo $myData['the_url'];?>" size="50" /></td>
      </tr>
      <tr height="30">
        <td >图片：</td>
        <td >
        	<?php 
				if(is_file($rootdir.$myData['pic'])){
					echo '<a href="'.$_BASE_DIR.str_replace('\\','/',$myData['pic']).'" target="_blank"><img src="'.$_BASE_DIR.str_replace('\\','/',$myData['pic']).'" width="50" height="40"/></a>&nbsp;&nbsp;<a href="'.url('banner/edit', array('banner_id'=>$myData['banner_id'],'actionValue'=>'deletePic')).'" onclick="return deletePic()" style="color:blue;" title="删除">[删除]</a>';	
				}else{
					echo '<input type="file" name="pic" id="pic" />';
				}
			?>
        
<span class="error"><?php echo $error_pic_msg;?></span></td>
      </tr>
    </table>
  </fieldset>
  <input type="hidden" name="id" value="<?php echo $myData['id'];?>" />
  <table width="900">
    <tr align="center" height="30">
      <td ><input name="按钮" type="submit" class="btn" style="margin-left: 14px;" value="提交">
        &nbsp;&nbsp;
        <input type="button" class="btn" value="返回" onclick="javascript:location='<?php echo url('banner')?>';"></td>
    </tr>
  </table>
</form>
<?php $this->_endblock(); ?>
